\(\int \frac {\sin ^2(c+d x)}{(a+a \sec (c+d x))^2} \, dx\) [86]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 69 \[ \int \frac {\sin ^2(c+d x)}{(a+a \sec (c+d x))^2} \, dx=-\frac {5 x}{2 a^2}+\frac {2 \sin (c+d x)}{a^2 d}-\frac {\cos (c+d x) \sin (c+d x)}{2 a^2 d}+\frac {2 \sin (c+d x)}{a^2 d (1+\cos (c+d x))} \]

[Out]

-5/2*x/a^2+2*sin(d*x+c)/a^2/d-1/2*cos(d*x+c)*sin(d*x+c)/a^2/d+2*sin(d*x+c)/a^2/d/(1+cos(d*x+c))

Rubi [A] (verified)

Time = 0.39 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.381, Rules used = {3957, 2953, 3029, 2788, 2717, 2715, 8, 2727} \[ \int \frac {\sin ^2(c+d x)}{(a+a \sec (c+d x))^2} \, dx=\frac {2 \sin (c+d x)}{a^2 d}-\frac {\sin (c+d x) \cos (c+d x)}{2 a^2 d}+\frac {2 \sin (c+d x)}{a^2 d (\cos (c+d x)+1)}-\frac {5 x}{2 a^2} \]

[In]

Int[Sin[c + d*x]^2/(a + a*Sec[c + d*x])^2,x]

[Out]

(-5*x)/(2*a^2) + (2*Sin[c + d*x])/(a^2*d) - (Cos[c + d*x]*Sin[c + d*x])/(2*a^2*d) + (2*Sin[c + d*x])/(a^2*d*(1
 + Cos[c + d*x]))

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 2727

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + d*x]/(d*(b + a*Sin[c + d*x])), x]
/; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 2788

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*tan[(e_.) + (f_.)*(x_)]^(p_), x_Symbol] :> Dist[a^p, Int[Expan
dIntegrand[Sin[e + f*x]^p*((a + b*Sin[e + f*x])^(m - p/2)/(a - b*Sin[e + f*x])^(p/2)), x], x], x] /; FreeQ[{a,
 b, e, f}, x] && EqQ[a^2 - b^2, 0] && IntegersQ[m, p/2] && (LtQ[p, 0] || GtQ[m - p/2, 0])

Rule 2953

Int[cos[(e_.) + (f_.)*(x_)]^2*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)
, x_Symbol] :> Dist[1/b^2, Int[(d*Sin[e + f*x])^n*(a + b*Sin[e + f*x])^(m + 1)*(a - b*Sin[e + f*x]), x], x] /;
 FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 - b^2, 0] && (ILtQ[m, 0] ||  !IGtQ[n, 0])

Rule 3029

Int[sin[(e_.) + (f_.)*(x_)]^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*sin[(e_.) + (f_.)*
(x_)])^(n_.), x_Symbol] :> Dist[a^n*c^n, Int[Tan[e + f*x]^p*(a + b*Sin[e + f*x])^(m - n), x], x] /; FreeQ[{a,
b, c, d, e, f, m}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 - b^2, 0] && EqQ[p + 2*n, 0] && IntegerQ[n]

Rule 3957

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Int[(g*Co
s[e + f*x])^p*((b + a*Sin[e + f*x])^m/Sin[e + f*x]^m), x] /; FreeQ[{a, b, e, f, g, p}, x] && IntegerQ[m]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cos ^2(c+d x) \sin ^2(c+d x)}{(-a-a \cos (c+d x))^2} \, dx \\ & = \frac {\int \frac {\cos ^2(c+d x) (-a+a \cos (c+d x))}{-a-a \cos (c+d x)} \, dx}{a^2} \\ & = \frac {\int (-a+a \cos (c+d x))^2 \cot ^2(c+d x) \, dx}{a^4} \\ & = \frac {\int \left (-2+2 \cos (c+d x)-\cos ^2(c+d x)+\frac {2}{1+\cos (c+d x)}\right ) \, dx}{a^2} \\ & = -\frac {2 x}{a^2}-\frac {\int \cos ^2(c+d x) \, dx}{a^2}+\frac {2 \int \cos (c+d x) \, dx}{a^2}+\frac {2 \int \frac {1}{1+\cos (c+d x)} \, dx}{a^2} \\ & = -\frac {2 x}{a^2}+\frac {2 \sin (c+d x)}{a^2 d}-\frac {\cos (c+d x) \sin (c+d x)}{2 a^2 d}+\frac {2 \sin (c+d x)}{a^2 d (1+\cos (c+d x))}-\frac {\int 1 \, dx}{2 a^2} \\ & = -\frac {5 x}{2 a^2}+\frac {2 \sin (c+d x)}{a^2 d}-\frac {\cos (c+d x) \sin (c+d x)}{2 a^2 d}+\frac {2 \sin (c+d x)}{a^2 d (1+\cos (c+d x))} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.46 (sec) , antiderivative size = 121, normalized size of antiderivative = 1.75 \[ \int \frac {\sin ^2(c+d x)}{(a+a \sec (c+d x))^2} \, dx=-\frac {\sec \left (\frac {c}{2}\right ) \sec \left (\frac {1}{2} (c+d x)\right ) \left (60 d x \cos \left (\frac {d x}{2}\right )+60 d x \cos \left (c+\frac {d x}{2}\right )-119 \sin \left (\frac {d x}{2}\right )-25 \sin \left (c+\frac {d x}{2}\right )-21 \sin \left (c+\frac {3 d x}{2}\right )-21 \sin \left (2 c+\frac {3 d x}{2}\right )+3 \sin \left (2 c+\frac {5 d x}{2}\right )+3 \sin \left (3 c+\frac {5 d x}{2}\right )\right )}{48 a^2 d} \]

[In]

Integrate[Sin[c + d*x]^2/(a + a*Sec[c + d*x])^2,x]

[Out]

-1/48*(Sec[c/2]*Sec[(c + d*x)/2]*(60*d*x*Cos[(d*x)/2] + 60*d*x*Cos[c + (d*x)/2] - 119*Sin[(d*x)/2] - 25*Sin[c
+ (d*x)/2] - 21*Sin[c + (3*d*x)/2] - 21*Sin[2*c + (3*d*x)/2] + 3*Sin[2*c + (5*d*x)/2] + 3*Sin[3*c + (5*d*x)/2]
))/(a^2*d)

Maple [A] (verified)

Time = 0.80 (sec) , antiderivative size = 45, normalized size of antiderivative = 0.65

method result size
parallelrisch \(\frac {\left (15-\cos \left (2 d x +2 c \right )+6 \cos \left (d x +c \right )\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-10 d x}{4 a^{2} d}\) \(45\)
derivativedivides \(\frac {2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {2 \left (-\frac {5 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{2}-\frac {3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2}\right )}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2}}-5 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{2} d}\) \(73\)
default \(\frac {2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {2 \left (-\frac {5 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{2}-\frac {3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2}\right )}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2}}-5 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{2} d}\) \(73\)
risch \(-\frac {5 x}{2 a^{2}}-\frac {i {\mathrm e}^{i \left (d x +c \right )}}{a^{2} d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )}}{a^{2} d}+\frac {4 i}{a^{2} d \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}-\frac {\sin \left (2 d x +2 c \right )}{4 a^{2} d}\) \(83\)
norman \(\frac {-\frac {5 x}{2 a}+\frac {5 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}+\frac {9 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{a d}+\frac {2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{a d}-\frac {5 x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{a}-\frac {5 x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{2 a}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2} a}\) \(116\)

[In]

int(sin(d*x+c)^2/(a+a*sec(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/4*((15-cos(2*d*x+2*c)+6*cos(d*x+c))*tan(1/2*d*x+1/2*c)-10*d*x)/a^2/d

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 61, normalized size of antiderivative = 0.88 \[ \int \frac {\sin ^2(c+d x)}{(a+a \sec (c+d x))^2} \, dx=-\frac {5 \, d x \cos \left (d x + c\right ) + 5 \, d x + {\left (\cos \left (d x + c\right )^{2} - 3 \, \cos \left (d x + c\right ) - 8\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{2} d \cos \left (d x + c\right ) + a^{2} d\right )}} \]

[In]

integrate(sin(d*x+c)^2/(a+a*sec(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/2*(5*d*x*cos(d*x + c) + 5*d*x + (cos(d*x + c)^2 - 3*cos(d*x + c) - 8)*sin(d*x + c))/(a^2*d*cos(d*x + c) + a
^2*d)

Sympy [F]

\[ \int \frac {\sin ^2(c+d x)}{(a+a \sec (c+d x))^2} \, dx=\frac {\int \frac {\sin ^{2}{\left (c + d x \right )}}{\sec ^{2}{\left (c + d x \right )} + 2 \sec {\left (c + d x \right )} + 1}\, dx}{a^{2}} \]

[In]

integrate(sin(d*x+c)**2/(a+a*sec(d*x+c))**2,x)

[Out]

Integral(sin(c + d*x)**2/(sec(c + d*x)**2 + 2*sec(c + d*x) + 1), x)/a**2

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 140 vs. \(2 (65) = 130\).

Time = 0.28 (sec) , antiderivative size = 140, normalized size of antiderivative = 2.03 \[ \int \frac {\sin ^2(c+d x)}{(a+a \sec (c+d x))^2} \, dx=\frac {\frac {\frac {3 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {5 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2} + \frac {2 \, a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}}} - \frac {5 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a^{2}} + \frac {2 \, \sin \left (d x + c\right )}{a^{2} {\left (\cos \left (d x + c\right ) + 1\right )}}}{d} \]

[In]

integrate(sin(d*x+c)^2/(a+a*sec(d*x+c))^2,x, algorithm="maxima")

[Out]

((3*sin(d*x + c)/(cos(d*x + c) + 1) + 5*sin(d*x + c)^3/(cos(d*x + c) + 1)^3)/(a^2 + 2*a^2*sin(d*x + c)^2/(cos(
d*x + c) + 1)^2 + a^2*sin(d*x + c)^4/(cos(d*x + c) + 1)^4) - 5*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a^2 + 2
*sin(d*x + c)/(a^2*(cos(d*x + c) + 1)))/d

Giac [A] (verification not implemented)

none

Time = 0.34 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.09 \[ \int \frac {\sin ^2(c+d x)}{(a+a \sec (c+d x))^2} \, dx=-\frac {\frac {5 \, {\left (d x + c\right )}}{a^{2}} - \frac {4 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{2}} - \frac {2 \, {\left (5 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2} a^{2}}}{2 \, d} \]

[In]

integrate(sin(d*x+c)^2/(a+a*sec(d*x+c))^2,x, algorithm="giac")

[Out]

-1/2*(5*(d*x + c)/a^2 - 4*tan(1/2*d*x + 1/2*c)/a^2 - 2*(5*tan(1/2*d*x + 1/2*c)^3 + 3*tan(1/2*d*x + 1/2*c))/((t
an(1/2*d*x + 1/2*c)^2 + 1)^2*a^2))/d

Mupad [B] (verification not implemented)

Time = 13.16 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.32 \[ \int \frac {\sin ^2(c+d x)}{(a+a \sec (c+d x))^2} \, dx=\frac {4\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-5\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (c+d\,x\right )+10\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-4\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,a^2\,d\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )} \]

[In]

int(sin(c + d*x)^2/(a + a/cos(c + d*x))^2,x)

[Out]

(4*sin(c/2 + (d*x)/2) - 5*cos(c/2 + (d*x)/2)*(c + d*x) + 10*cos(c/2 + (d*x)/2)^2*sin(c/2 + (d*x)/2) - 4*cos(c/
2 + (d*x)/2)^4*sin(c/2 + (d*x)/2))/(2*a^2*d*cos(c/2 + (d*x)/2))